const express = require('express');
const router = express.Router();

router.get('/forCurrentUser', (req, res) => {
    const content = [];
    for(let i = 1; i <= 20; i++) content.push({
        id: `${i}`,
        dealerCode: `dealerCode${i}`,
        dealerName: '奇瑞国际',
        code: `code${i}`,
        batchNumber: `batchNumber${i}`,
        totalAmount: 11151,
        currency: 1,
        status: 1,
        createTime: '2020-03-09T06:27:30.349Z',
        rowVersion: 'rowVersion',
        options: [
            'declare',
            'clearancet'
        ]
    });
    res.json(
        {
            message: '',
            payload: {
                content,
                totalElements: 20,
            }
        }
    );
});

router.get('/:id', (req, res) => {
    res.json({
        payload: {
            id: 'id1',
            code: 'code',
            brandName: 'brandName',
            dealerCode: 'dealerCode',
            dealerName: 'dealerName',
            tradeMethodName: 'tradeMethodName',
            salesOrderPriceTerms: 1,
            payment: 1,
            letterOfCreditId: 'letterOfCreditId001',
            letterOfCreditCode: 'letterOfCreditCode',
            LcVersionCode: 1,
            shipmentAmount: 12412,
            insuranceAmount: 21313,
            totalAmount: 14453256,
            currency: 1,
            transportType: 1,
            shippingPortName: 'shippingPortName',
            destinationPort: 'destinationPort',
            batchNumber: 'batchNumber',
            rowVersion: 'string',
            options: [
                'declare',
                'clearancet'
            ],
            declareAttachments: [
                {
                    fileId: 'declareId',
                    fileName: '下载报关附件清单1'
                }
            ],
            clearanceAttachments: [
                {
                    fileId: 'clearanceId',
                    fileName: '下载清关附件清单1'
                }
            ]
        }
    });
});


router.put('/:id/declare', (req, res) => {
    res.json({
        message: 'success'
    });
});

router.put('/:id/clearance', (req, res) => {
    res.json({
        message: 'success'
    });
});

module.exports = router;
